package com.bg2009.ancienttech;

import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

public class CreativeModeTabReg {

    // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "ancienttech" namespace
    public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, AncientTechMain.MODID);

    // 创建一个创造模式页面 通过id" ancienttech:ancient_tech_tab " for the example item, 将会放在 combat tab 后
    public static final DeferredHolder<CreativeModeTab, CreativeModeTab> ANCIENT_TECH_TAB = CREATIVE_MODE_TABS.register("ancient_tech_tab", () -> CreativeModeTab.builder()
            .title(Component.translatable("itemGroup.ancienttech")) //The language key for the title of your CreativeModeTab
            .withTabsBefore(CreativeModeTabs.COMBAT)
            .icon(() -> ItemReg.ANCIENT_FRUIT.get().getDefaultInstance())
            .displayItems((parameters, output) -> {
                output.accept(ItemReg.ANCIENT_FRUIT.get());
                output.accept(ItemReg.EXAMPLE_ITEM.get());// 添加 示例物品 到tab页面. 对于你自己的tabs, 这种方法比事件更可取
                output.accept(ItemReg.ANCIENT_GRASS_ITEM.get());
            })
            .build());

}
